//获取应用实例
const app = getApp()
Page({
  data: {

    livs:[],
    // 组件所需的参数
    nvabarData: {
      showCapsule: 1, //是否显示左上角图标   1表示显示    0表示不显示
      title: '地址管理', //导航栏 中间的标题
    },
    // 此页面 页面内容距最顶部的距离
    height: app.globalData.height * 2 + 20,
  },
  onLoad() {
   
    let that = this;
    let url = app.globalData.URL+'goods/address/list';
        let data = {};
        app.wxRequest('GET', url, data, (res) => {
          let livs = res.rows
          that.setData({
            livs:livs
          })
          console.log(livs)
        }, (err) => {
          console.log(err.errMsg)
        })
  },
  add_live:function(e){
    wx.navigateTo({
      url: '/modelB/pages/my/add_live/add_live',
      success: function(res) {},
      fail: function(res) {},
      complete: function(res) {},
    })
  },
  // 修改
  goaddliv:function(e){
    let that = this;
    let id = e.currentTarget.dataset.id;
    wx.navigateTo({
      url: '/modelB/pages/my/add_live/add_live?id='+id,
      success: function(res) {},
      fail: function(res) {},
      complete: function(res) {},
    })
  },
// 删除
  deleliv:function(e){
    let that = this;
    let id = e.currentTarget.dataset.id;
    let url = app.globalData.URL+'goods/address/'+id;
        let data = {};
        app.wxRequest('DELETE', url, data, (res) => {
          console.log(res)
        }, (err) => {
          console.log(err.errMsg)
        })
  }
  
})
